package com.flyme.module.base.provider.service.impl;

import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.base.client.entity.SysConfig;
import com.flyme.module.base.provider.mapper.SysConfigMapper;
import com.flyme.module.base.provider.service.SysConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: zyf
 * @date: 2018/10/24 16:33
 * @description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysConfigServiceImpl extends BaseServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {

    /**
     * 根据名称查询
     */
    public SysConfig getByName(String configName) {
        return getOne(q().eq(true,"configName", configName), false);
    }

    @Override
    public List<SysConfig> getVodInfo(){
        String[] vod = {"AccessKeyId", "AccessKeySecret", "SecurityToken"};
        return list(q().in("configName", vod));
    }

    @Override
    public SysConfig getNuoInfo(){
        return getOne(q().eq(true, "configName", "nuoToken"), false);
    }
}
